﻿<%@ Page Language="VB" %>

<%@ Register Src="~/ColorViewer.ascx" TagName="ColorViewer" TagPrefix="sl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
        Using a = New langsamu.ColourLovers.Service
        End Using
        
        MyBase.OnLoad(e)
    End Sub

    Protected Sub GetColorsButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles GetColorsButton.Click
        Using service = New langsamu.ColourLovers.Service
            ColorList.DataSource = service.GetColors
            ColorList.DataBind()
        End Using
    End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form runat="server">
    <div>
        <asp:Button ID="GetColorsButton" runat="server" Text="get colors" />
        <asp:ListView ID="ColorList" runat="server">
            <LayoutTemplate>
                <ul>
                    <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
                </ul>
            </LayoutTemplate>
            <ItemTemplate>
                <asp:Panel BorderColor='<%#Container.DataItem.ToNative %>' BorderWidth="20px" Style="padding: 10px; margin: 10px" runat="server">
                    <sl:ColorViewer runat="server" />
                </asp:Panel>
            </ItemTemplate>
        </asp:ListView>
    </div>
    </form>
</body>
</html>
